﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace WpfStudy
{
    public class EnumConvert:IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            RoleType role = (RoleType)value;
            if (role == RoleType.Administrator)
            {
                return "管理员";
            }
            else if (role == RoleType.Engineer)
            {
                return "工程师";
            }
            else
            {
                return "操作者";
            }
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
